using UnityEngine;


namespace XFGameFramework
{


    public static class GameObjectExtensions
    {
        public static void SetLayer(this GameObject gameObject, int layer)
        {
            Transform[] transforms = gameObject.GetComponentsInChildren<Transform>();
            foreach (var item in transforms)
            {
                item.gameObject.layer = layer;
            }
        }

        public static bool IsDestroy(this GameObject gameObject)
        {

            try
            {
                if (gameObject == null) return true;
            }
            catch (System.Exception e)
            {
                Debug.LogFormat("Message:{0} Type:{1}", e.Message, e.GetType().FullName);
                return true;
            }
            return false;
        }

    }

}